# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day111_pyqt5_boxlayout
   Description :
   Author :       fuml
   date：          2019/9/20
-------------------------------------------------
   Change Activity:
            2019/9/20:
            In this example, we position two push
            buttons in the bottom-right corner
            of the window.
-------------------------------------------------
"""

import  sys
from PyQt5.QtWidgets import (QWidget,QApplication,QLabel,QPushButton,
                             QVBoxLayout,QHBoxLayout)
from PyQt5.QtGui import QIcon

class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        okbutton = QPushButton("ok")
        cancelbutton = QPushButton("cancel")

        hlayout = QHBoxLayout()
        hlayout.addStretch(1)
        hlayout.addWidget(okbutton)
        #hlayout.addStretch(1)
        hlayout.addWidget(cancelbutton)

        vlayout = QVBoxLayout()
        vlayout.addStretch(1)
        vlayout.addLayout(hlayout)

        self.setLayout(vlayout)
        #set gemotry
        self.setGeometry(300,300,300,150)
        self.setWindowTitle('buttons layout')
        #self.setWindowIcon(QIcon('web.png'))


        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex=Example()
    sys.exit(app.exec_())
